<!--
 * @Author: coman
 * @LastEditors: coman
 * @Date: 2020-06-18 20:45:19
 * @motto: No pain,No gain
 * @LastEditTime: 2020-06-18 21:11:28
--> 
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /* 寻找连续5位数中的最大数 */
        function findTopFive(str){
            var str_new=new Array();
            var max=0;
            str2=str.split("");
           for(var i=0;i<str2.length;i++){
               str1="";
               
               if((i+5)<str2.length+1) {
                   str1 =str.slice(i,i+5)
                   str_new.push(str1);
                   }else{
                       break;
                   }
           }
           for(var i=0;i<str_new.length;i++){
                if(max<str_new[i]){
                    max=str_new[i];
                }
           }
           console.log(max);
           
          return max
           
           
        }
     console.log(findTopFive('1234567890'));
    </script>
</body>
</html>